# -*- coding:utf-8 -*-
# author:qiong   time:2021/9/17

# 首页页面对象

from selenium.webdriver.common.by import By
from mkzAPP_test.base.baseApp import basePageElement, baseHandle


# 元素对象层
class homeElement(basePageElement):
    def __init__(self):
        super().__init__()
        # 我的选项卡按钮路径
        self.me_btn = By.ID,"com.xmtj.mkz:id/ll_mine"
        # 分类选项卡按钮
        self.classification_btn = By.ID,"com.xmtj.mkz:id/tab_ll_category"


    def find_me_btn(self):
        return self.wait_getelement(self.me_btn)

    def find_classification_btn(self):
        return self.wait_getelement(self.classification_btn)


# 操作层
class homeHandle(baseHandle):

    # 实例化元素对象
    def __init__(self):
        self.home_element = homeElement()

    def clickMe_btn(self):
        self.home_element.find_me_btn().click()

    def clickClassification_btn(self):
        self.home_element.find_classification_btn().click()

# 业务层

class homeProxy:

    def __init__(self):
        self.home_handle = homeHandle()

    # 点击我的按钮切换到我的页面
    def to_me_page(self):
        self.home_handle.clickMe_btn()

    # 点击分类按钮切换到分类页面
    def to_classification_page(self):
        self.home_handle.clickClassification_btn()